<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>混入可复用</title>
    <script src="../vue.global.js"></script>
    <style>
        .red{
            color:red;
        }
        .font-big{
            font-size: 50px;
        }
    </style>
</head>
<body>

<div id="App">

    <input type="text" name="user" ref="user" v-model="user.name" v-model="user.age"/>
    {{user.name}}
    {{user.age}}

    <br/>
    {{other}}
</div>


<script>



    const baseMix = {
        data(){
            return {
                user:{
                    name:"jack",
                    age:10000
                }
            }
        },
        created(){
            this.user.age=999
            console.log("复用钩子函数1")
        }
    }
    const app = Vue.createApp({

        mixins: [baseMix],
        data(){
            return {
                other:"混入可复用、合并，替换"
            }
        },
        created(){
            this.user.age=666
            console.log("复用钩子函数2")
        }

    });

    const vm =app.mount("#App");


</script>
</body>
</html>